<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>AIfES 2: ailoss_crossentropy.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="AIfES_logo_small.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">AIfES 2
   &#160;<span id="projectnumber">2.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('ailoss__crossentropy_8h.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">ailoss_crossentropy.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Base <a class="el" href="structailoss.html">loss </a> implementation of the Cross-Entropy loss.  
<a href="#details">More...</a></p>

<p><a href="ailoss__crossentropy_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailoss__crossentropy.html">ailoss_crossentropy</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">General <a class="el" href="ailoss__crossentropy_8h.html">Cross-Entropy loss </a> struct.  <a href="structailoss__crossentropy.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:a56ea9887c556a04a95748f51eb39cc6d"><td class="memItemLeft" align="right" valign="top"><a id="a56ea9887c556a04a95748f51eb39cc6d"></a>
typedef struct <a class="el" href="structailoss__crossentropy.html">ailoss_crossentropy</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ailoss__crossentropy_8h.html#a56ea9887c556a04a95748f51eb39cc6d">ailoss_crossentropy_t</a></td></tr>
<tr class="memdesc:a56ea9887c556a04a95748f51eb39cc6d"><td class="mdescLeft">&#160;</td><td class="mdescRight">New data type name for code reduction. <br /></td></tr>
<tr class="separator:a56ea9887c556a04a95748f51eb39cc6d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a01fb5e844bd40d1318d29767ef9c4483"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structailoss.html">ailoss_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ailoss__crossentropy_8h.html#a01fb5e844bd40d1318d29767ef9c4483">ailoss_crossentropy</a> (<a class="el" href="ailoss__crossentropy_8h.html#a56ea9887c556a04a95748f51eb39cc6d">ailoss_crossentropy_t</a> *loss, <a class="el" href="structailayer.html">ailayer_t</a> *input_layer)</td></tr>
<tr class="memdesc:a01fb5e844bd40d1318d29767ef9c4483"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize and connect the given Cross-Entropy loss.  <a href="ailoss__crossentropy_8h.html#a01fb5e844bd40d1318d29767ef9c4483">More...</a><br /></td></tr>
<tr class="separator:a01fb5e844bd40d1318d29767ef9c4483"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0d3786e3889488435b149772729070b0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ailoss__crossentropy_8h.html#a0d3786e3889488435b149772729070b0">ailoss_crossentropy_calc_delta</a> (<a class="el" href="structailoss.html">ailoss_t</a> *self, const <a class="el" href="structaitensor.html">aitensor_t</a> *target_data)</td></tr>
<tr class="memdesc:a0d3786e3889488435b149772729070b0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculate the combined derivative of the given Cross-Entropy loss and the output layer for error backpropagation.  <a href="ailoss__crossentropy_8h.html#a0d3786e3889488435b149772729070b0">More...</a><br /></td></tr>
<tr class="separator:a0d3786e3889488435b149772729070b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7609a343755d8e7ac3edba32aeced667"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ailoss__crossentropy_8h.html#a7609a343755d8e7ac3edba32aeced667">ailoss_crossentropy_calc_loss</a> (<a class="el" href="structailoss.html">ailoss_t</a> *self, const <a class="el" href="structaitensor.html">aitensor_t</a> *target_data, void *result)</td></tr>
<tr class="memdesc:a7609a343755d8e7ac3edba32aeced667"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculate the Cross-Entropy loss on the given target data.  <a href="ailoss__crossentropy_8h.html#a7609a343755d8e7ac3edba32aeced667">More...</a><br /></td></tr>
<tr class="separator:a7609a343755d8e7ac3edba32aeced667"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6495ab52d2d6911f27ad06a6431f2f0a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ailoss__crossentropy_8h.html#a6495ab52d2d6911f27ad06a6431f2f0a">ailoss_crossentropy_dummy_backward</a> (<a class="el" href="structailayer.html">ailayer_t</a> *self)</td></tr>
<tr class="memdesc:a6495ab52d2d6911f27ad06a6431f2f0a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Dummy backward-function for the output layer of the model.  <a href="ailoss__crossentropy_8h.html#a6495ab52d2d6911f27ad06a6431f2f0a">More...</a><br /></td></tr>
<tr class="separator:a6495ab52d2d6911f27ad06a6431f2f0a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aade66fe1598961b028615f1397c51720"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ailoss__crossentropy_8h.html#aade66fe1598961b028615f1397c51720">ailoss_crossentropy_print_specs</a> (const <a class="el" href="structailoss.html">ailoss_t</a> *self)</td></tr>
<tr class="memdesc:aade66fe1598961b028615f1397c51720"><td class="mdescLeft">&#160;</td><td class="mdescRight">Print the loss specification.  <a href="ailoss__crossentropy_8h.html#aade66fe1598961b028615f1397c51720">More...</a><br /></td></tr>
<tr class="separator:aade66fe1598961b028615f1397c51720"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a6efcc57d18e614d7745ee381254e0545"><td class="memItemLeft" align="right" valign="top">const <a class="el" href="structaicore__losstype.html">aicore_losstype_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ailoss__crossentropy_8h.html#a6efcc57d18e614d7745ee381254e0545">ailoss_crossentropy_type</a></td></tr>
<tr class="memdesc:a6efcc57d18e614d7745ee381254e0545"><td class="mdescLeft">&#160;</td><td class="mdescRight">Cross-Entropy loss type.  <a href="ailoss__crossentropy_8h.html#a6efcc57d18e614d7745ee381254e0545">More...</a><br /></td></tr>
<tr class="separator:a6efcc57d18e614d7745ee381254e0545"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Base <a class="el" href="structailoss.html">loss </a> implementation of the Cross-Entropy loss. </p>
<dl class="section version"><dt>Version</dt><dd>2.2.0 </dd></dl>
<dl class="section copyright"><dt>Copyright</dt><dd>Copyright (C) 2020-2023 Fraunhofer Institute for Microelectronic Circuits and Systems. All rights reserved.<br  />
<br  />
 AIfES is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.<br  />
<br  />
 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.<br  />
<br  />
 You should have received a copy of the GNU Affero General Public License along with this program. If not, see <a href="https://www.gnu.org/licenses/">https://www.gnu.org/licenses/</a>.</dd></dl>
<p>This is an "abstract" data-type independent implementation. To use the loss, use one of the provided implementations for a specific hardware and data-type (for example from <a class="el" href="ailoss__crossentropy__default_8h.html" title="Default implementation of the Cross-Entropy loss .">ailoss_crossentropy_default.h</a>) or set the required math functions on your own.</p>
<p>The Cross-Entropy loss ist best suitable for classification tasks and <b>works only with <a class="el" href="ailayer__sigmoid_8h.html">Sigmoid </a> or <a class="el" href="ailayer__softmax_8h.html">Softmax </a> output layers</b>.</p>
<p>For <b>binary classification</b> (binary targets 0 or 1) with <b>Sigmoid output layer</b>, the loss / cost is calculated as </p><p class="formulaDsp">
\[ L(y, \hat{y}) = - \sum_{i=0}^{N} (y_i \log(\hat{y}_i) + (1-y) \log(1-\hat{y}_i)) \]
</p>
<p> with the predicted values \( \hat{y}_i \) and the target values \( y_i \). \( N \) is the number of elements of the \( y \) tensor.</p>
<p>For <b>categorigal classification</b> (one-hot encoded targets) with <b>Softmax output layer</b>, the loss / cost is calculated as </p><p class="formulaDsp">
\[ L(y, \hat{y}) = - \sum_{i=0}^{N} y_{i} \log(\hat{y}_{i}) \]
</p>
<p> with the predicted values \( \hat{y}_i \) and the target values \( y_i \). \( N \) is the number of elements of the \( y \) tensor.</p>
<p>To get the "mean" normalization, you have to modify the learning rate to \( lr = \frac {1}{o \cdot n} \cdot lr \) with the number of outputs \( o \) and the batch size \( n \).</p>
<p>The loss can be calculated with <a class="el" href="ailoss__crossentropy_8h.html#a7609a343755d8e7ac3edba32aeced667" title="Calculate the Cross-Entropy loss on the given target data.">ailoss_crossentropy_calc_loss()</a>. For training the deltas /errors on the target data are calculated with <a class="el" href="ailoss__crossentropy_8h.html#a0d3786e3889488435b149772729070b0" title="Calculate the combined derivative of the given Cross-Entropy loss and the output layer for error back...">ailoss_crossentropy_calc_delta()</a> and written to the deltas tensor of the connection layer. </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a01fb5e844bd40d1318d29767ef9c4483"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a01fb5e844bd40d1318d29767ef9c4483">&#9670;&nbsp;</a></span>ailoss_crossentropy()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structailoss.html">ailoss_t</a>* <a class="el" href="structailoss__crossentropy.html">ailoss_crossentropy</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ailoss__crossentropy_8h.html#a56ea9887c556a04a95748f51eb39cc6d">ailoss_crossentropy_t</a> *&#160;</td>
          <td class="paramname"><em>loss</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structailayer.html">ailayer_t</a> *&#160;</td>
          <td class="paramname"><em>input_layer</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize and connect the given Cross-Entropy loss. </p>
<p>This function represents the "constructor" of the abstract Cross-Entropy loss. It initializes the loss structure and connects it to the output layer of the AIfES model.<br  />
This function is not intended to call it directly. Instead use one of the data type specific implementations (like for example <a class="el" href="ailoss__crossentropy__default_8h.html#aa10b5c43deef1891d98cb8c45d57b3ee" title="Initializes and connect a Cross-Entropy loss  with the F32  default implementation using a mean reduc...">ailoss_crossentropy_f32_default()</a>).</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*loss</td><td>The loss to initialize. </td></tr>
    <tr><td class="paramname">*input_layer</td><td>The output layer of the model that provides the inputs to the loss. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Pointer to the (successfully) initialized loss structure. </dd></dl>

</div>
</div>
<a id="a0d3786e3889488435b149772729070b0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0d3786e3889488435b149772729070b0">&#9670;&nbsp;</a></span>ailoss_crossentropy_calc_delta()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ailoss_crossentropy_calc_delta </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structailoss.html">ailoss_t</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>target_data</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculate the combined derivative of the given Cross-Entropy loss and the output layer for error backpropagation. </p>
<p><em>Implementation of <a class="el" href="structailoss.html#ae84860a963e24221ba373a1554f20930" title="Calculate the error on the target data and write it to the deltas tensor of connection layer.">ailoss.calc_delta</a>.</em></p>
<p>It uses the result tensor of the output layer and the target data as input and writes the result to the deltas tensor (<a class="el" href="structailayer.html#a6e0cd193754d9614d5da823f0f0fcbf6" title="The result of the backward function is stored here.">ailayer.deltas</a>) of the output layer of the model.</p>
<p>By combining the Cross-Entropy loss with a Sigmoid or Softmax output layer, the combined deltas can be calculated very efficiently. The backward function of the Sigmoid / Softmax layer is not used anymore.</p>
<p>Calculation of the deltas: </p><p class="formulaDsp">
\[ \delta_{in} \leftarrow p - y \]
</p>
<p>\( \delta_{in} \): Result of the delta calculation of this loss (written to <a class="el" href="structailayer.html#a6e0cd193754d9614d5da823f0f0fcbf6" title="The result of the backward function is stored here.">ailayer.deltas</a> of the output layer of the model)<br  />
 \( p \): Result of the forward pass of the output layer of the model (predicted values)<br  />
 \( y \): Target data / True values / Labels<br  />
<br  />
 Used math functions:</p><ul>
<li><a class="el" href="structailoss__crossentropy.html#a5f5b55cad6c306233a8e4510d1773244" title="Required math function: Element wise tensor subtraction.">ailoss_crossentropy.tensor_sub</a></li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*self</td><td>Loss to calculate the deltas for </td></tr>
    <tr><td class="paramname">*target_data</td><td>Target data / True values / Labels </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a7609a343755d8e7ac3edba32aeced667"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7609a343755d8e7ac3edba32aeced667">&#9670;&nbsp;</a></span>ailoss_crossentropy_calc_loss()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ailoss_crossentropy_calc_loss </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structailoss.html">ailoss_t</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>target_data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculate the Cross-Entropy loss on the given target data. </p>
<p><em>Implementation of <a class="el" href="structailoss.html#afb6e75cd4aa201c51f7f220dc15abcb3" title="Calculate the loss / cost for the model on the given targets.">ailoss.calc_loss</a>.</em></p>
<p>It uses the result tensor of the output layer and the target data as input and writes the result to the given result scalar.</p>
<p>Calculation of the loss with Sigmoid output layer: </p><p class="formulaDsp">
\[ result \leftarrow - \sum_i (y_i \log(p_i) + (1 - y_i) \log(1 - p_i)) \]
</p>
<p>Calculation of the loss with Softmax output layer: </p><p class="formulaDsp">
\[ result \leftarrow - \sum_i y_i \log(p_i) \]
</p>
<p>\( result \): Result of the loss calculation<br  />
 \( p \): Result of the forward pass of the output layer of the model (predicted values)<br  />
 \( y \): Target data / True values / Labels<br  />
<br  />
 Used math functions:</p><ul>
<li><a class="el" href="structailoss__crossentropy.html#a5f5b55cad6c306233a8e4510d1773244" title="Required math function: Element wise tensor subtraction.">ailoss_crossentropy.tensor_sub</a></li>
<li><a class="el" href="structailoss__crossentropy.html#aedaeff294e1c5d7e56da1531faa50fe4" title="Required math function: Cross-Entropy between two tensors.">ailoss_crossentropy.crossentropy</a></li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*self</td><td>Loss to calculate the deltas for </td></tr>
    <tr><td class="paramname">*target_data</td><td>Target data / True values / Labels </td></tr>
    <tr><td class="paramname">*result</td><td>Result scalar (the data type is specified by the data type specific implementations) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a6495ab52d2d6911f27ad06a6431f2f0a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6495ab52d2d6911f27ad06a6431f2f0a">&#9670;&nbsp;</a></span>ailoss_crossentropy_dummy_backward()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ailoss_crossentropy_dummy_backward </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structailayer.html">ailayer_t</a> *&#160;</td>
          <td class="paramname"><em>self</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Dummy backward-function for the output layer of the model. </p>
<p><em>Implementation of <a class="el" href="structailayer.html#a235e06f76bc9641b9c9b95ae29b56fe9" title="Calculate the backward pass and write the result to the deltas tensor.">ailayer.backward</a>.</em></p>
<p>The <a class="el" href="ailoss__crossentropy_8h.html#a0d3786e3889488435b149772729070b0" title="Calculate the combined derivative of the given Cross-Entropy loss and the output layer for error back...">ailoss_crossentropy_calc_delta()</a> function calculates the combined delta for a Sigmoid or Softmax layer with Cross-Entropy loss. Therefor the backward function of the Sigmoid / Softmax layer is not needed anymore and gets exchanged by this dummy function.</p>
<p>The dummy function does nothing.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*self</td><td>The output layer of the model </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="aade66fe1598961b028615f1397c51720"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aade66fe1598961b028615f1397c51720">&#9670;&nbsp;</a></span>ailoss_crossentropy_print_specs()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ailoss_crossentropy_print_specs </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structailoss.html">ailoss_t</a> *&#160;</td>
          <td class="paramname"><em>self</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Print the loss specification. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*self</td><td>The loss to print the specification for </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="a6efcc57d18e614d7745ee381254e0545"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6efcc57d18e614d7745ee381254e0545">&#9670;&nbsp;</a></span>ailoss_crossentropy_type</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const <a class="el" href="structaicore__losstype.html">aicore_losstype_t</a>* ailoss_crossentropy_type</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">extern</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Cross-Entropy loss type. </p>
<p>Defines the type of the loss (for example for type checks and debug prints). See <a class="el" href="structaicore__losstype.html" title="Type indicator of the loss to check for the loss type.">aicore_losstype</a> for more information about the loss type. </p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_1e5d3661ed79af157d57e64a38265d09.html">basic</a></li><li class="navelem"><a class="el" href="dir_90008ee2b0f86999412b56217da88d54.html">base</a></li><li class="navelem"><a class="el" href="dir_37a1ab58f3df7c16fa288867d2fe5335.html">ailoss</a></li><li class="navelem"><a class="el" href="ailoss__crossentropy_8h.html">ailoss_crossentropy.h</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
